/*
* $Id: SyncStart.cpp 339 2011-10-04 20:59:20Z volok-aleksej@yandex.ru $
*
* Copyright 2009-2011 by Volokitin Aleksey
* All rights reserved
*
*/
#include "Common/include.h"
#include "SyncStart.h"
#include "SyncChooseComPort.h"
#include "LanguageManager.h"

#define MOBILE_RADIO_ID 0x101

CSyncStart::CSyncStart(CWnd* pParentWnd)
: CWizardWarningStep(NULL, pParentWnd){
	m_fontHeader = CCommonFunction::GetFont(_T("Arial"), 16, true, false);
	m_font = CCommonFunction::GetFont(_T("Arial"), 16, false, false);
	m_pNext = new CSyncChooseComPort(this, pParentWnd);
}

CSyncStart::~CSyncStart(){
	m_fontHeader->DeleteObject();
	delete m_fontHeader;
	m_font->DeleteObject();
	delete m_font;
	delete m_pNext;
}

void CSyncStart::InitMain(CPoint offset){
	HWND backButton = GetDlgItem(m_pParentWnd->m_hWnd, ID_BACK);
	EnableWindow(backButton, FALSE);

	CStatic* header1 = new CStatic;
	header1->Create(CLanguageManager::GetLanguageManager()->GetString(SYNC_HEADER_ID).c_str(),
		WS_CHILD | WS_VISIBLE | SS_CENTER, CRect(offset, CSize(470, 20)), m_pParentWnd);
	header1->SetFont(m_fontHeader);
	AddWindow(header1);
	CStatic* header2 = new CStatic;
	header2->Create(CLanguageManager::GetLanguageManager()->GetString(SYNC_CHOOSE_TYPE_ID).c_str(),
		WS_CHILD | WS_VISIBLE | SS_LEFT, CRect(offset + CPoint(20, 20), CSize(450, 20)), m_pParentWnd);
	header2->SetFont(m_fontHeader);
	AddWindow(header2);
	CButton* radiobox = new CButton;
	radiobox->Create(CLanguageManager::GetLanguageManager()->GetString(MOBYLE_SYNC_ID).c_str(),
		WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_AUTORADIOBUTTON,
		CRect(offset + CPoint(20, 40), CSize(450, 20)), m_pParentWnd, MOBILE_RADIO_ID);
	radiobox->SetFont(m_font);
	radiobox->SetCheck(TRUE);
	AddWindow(radiobox);
}

CWizardStep* CSyncStart::Next(){
	CloseWindows();
	return m_pNext;
}

CWizardStep* CSyncStart::Back(){
	CloseWindows();
	return m_pBack;
}

void CSyncStart::InitWarning(CPoint offset){
	m_pWarning = new CStatic;
	m_pWarning->Create(CLanguageManager::GetLanguageManager()->GetString(SYNC_WARNING_ID).c_str(),
		WS_CHILD | SS_CENTER, CRect(offset + CPoint(20, 80), CSize(450, 60)), m_pParentWnd);
	m_pWarning->SetFont(m_fontHeader);
	AddWindow(m_pWarning);
	Update();
}